//
//  Project_RootViewController.m
//  Coding_My
//
//  Created by showXxie on 2017/8/21.
//  Copyright © 2017年 sooxie. All rights reserved.
//

#import "Project_RootViewController.h"
#import "MyTask_RootViewController.h"
#import "TestView.h"

@interface Project_RootViewController ()
@property (nonatomic,strong) TestView *testView;

@end

@implementation Project_RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    
    TestView *testView = [[TestView alloc]initWithFrame:CGRectMake(20, 50, 200, 200)];
    _testView = testView;
    testView.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:testView];
    
    
    
    
    
    [[testView rac_signalForSelector:@selector(click)] subscribeNext:^(id x) {
        
        NSLog(@"点击红色按钮");

    }];
    
    UIView *greenView = [[UIView alloc]initWithFrame:CGRectMake(30, 300, 100, 100)];
    greenView.backgroundColor = [UIColor greenColor];
    greenView.alpha = 0.4;
    greenView.layer.cornerRadius = 50;
    greenView.layer.masksToBounds = YES;
    [self.view addSubview:greenView];
    
    greenView.transform = CGAffineTransformMakeScale(1.0f, 1.0f);

    [UIView beginAnimations:@"greenView" context:nil];
    
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:1.5f];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [UIView setAnimationRepeatCount:FLT_MAX];
    
    greenView.transform = CGAffineTransformMakeScale(1.5f, 1.5f);
    greenView.alpha = 0;
    
    //提交动画
    [UIView commitAnimations];

    
    
    
}



- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    
    MyTask_RootViewController *task =   [[MyTask_RootViewController alloc] init];
    
    //1.创建信号
    task.delegateSignal = [RACSubject subject];
    //2.监听信号
    [task.delegateSignal subscribeNext:^(id x) {
        NSLog(@"点击了通知按钮");

    }];
    
    
    
    [_testView setY:100];
    
//    [self.navigationController pushViewController:task animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
